﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Erebos.GameScreenFiles;
using CSScriptLibrary;
using Microsoft.Xna.Framework;

namespace Erebos.CsharpEngine
{
    public interface IEvent
    {
        void Run(EventFunctions func);
    }

    class EventScript
    {
        private string _path;
        private IEvent _event;

        public EventScript(string path)
        {
            _path = path;
            _event = CSScript.Load(_path).CreateInstance("Event").AlignToInterface<IEvent>();
        }

        public void Run()
        {
            _event.Run(new EventFunctions());
        }
    }

    public class EventFunctions
    {
        public void AddExplosion(Vector3 pos)
        {
            Camera.World.CreateExplosion(new Vector3(pos.X, pos.Y, pos.Z));
        }

        public Vector3 GetCamPos()
        {
            return new Vector3(Camera.CameraPosition.X, Camera.CameraPosition.Y, -Camera.CameraPosition.Z);
        }

        public void ChangeMap(int id)
        {
            Camera.World.ChangeMap(id);
        }
    }
}
